package org.vs.test.contract;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import lombok.Builder;
import lombok.Data;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.Address;
import org.web3j.abi.datatypes.Function;
import org.web3j.abi.datatypes.StaticStruct;
import org.web3j.abi.datatypes.Type;
import org.web3j.abi.datatypes.generated.Uint16;
import org.web3j.crypto.Credentials;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.RemoteCall;
import org.web3j.protocol.core.RemoteFunctionCall;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
import org.web3j.tx.gas.ContractGasProvider;

/**
 * <p>Auto generated code.
 * <p><strong>Do not modify!</strong>
 * <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>,
 * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the 
 * <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
 *
 * <p>Generated with web3j version 1.5.0.
 */
@SuppressWarnings("rawtypes")
public class __Test02_sol_Test02 extends Contract {
    public static final String BINARY = "608060405234801561001057600080fd5b50610320806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063090725201461003b57806329b1d8c114610050575b600080fd5b61004e61004936600461017f565b610079565b005b61006361005e36600461015e565b6100fa565b6040516100709190610274565b60405180910390f35b60005b81518110156100f65760008282815181106100a757634e487b7160e01b600052603260045260246000fd5b6020908102919091018101518082015190516001600160a01b03166000908152918290526040909120805461ffff191661ffff90921691909117905550806100ee816102ad565b91505061007c565b5050565b6001600160a01b03811660009081526020819052604081205461ffff1661012357506000610142565b506001600160a01b03811660009081526020819052604090205461ffff165b919050565b80356001600160a01b038116811461014257600080fd5b60006020828403121561016f578081fd5b61017882610147565b9392505050565b60006020808385031215610191578182fd5b823567ffffffffffffffff808211156101a8578384fd5b818501915085601f8301126101bb578384fd5b8135818111156101cd576101cd6102d4565b6101da8485830201610283565b818152848101908486016040808502870188018b10156101f8578889fd5b8896505b848710156102655780828c031215610212578889fd5b8051818101818110888211171561022b5761022b6102d4565b825261023683610147565b81528883013561ffff8116811461024b578a8bfd5b818a015284526001969096019592870192908101906101fc565b50909998505050505050505050565b61ffff91909116815260200190565b60405181810167ffffffffffffffff811182821017156102a5576102a56102d4565b604052919050565b60006000198214156102cd57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fdfea26469706673582212208fe81a43b1630b7c565957f5fb230f53ec11bf539bdfa4644a9124db8354570f64736f6c63430008000033";

    public static final String FUNC_ADDPARTICIPANT = "addParticipant";

    public static final String FUNC_ISINPARTICIPANTMAP = "isInParticipantMap";

    @Deprecated
    protected __Test02_sol_Test02(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
    }

    protected __Test02_sol_Test02(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
        super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
    }

    @Deprecated
    protected __Test02_sol_Test02(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
    }

    protected __Test02_sol_Test02(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
        super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
    }

    public RemoteFunctionCall<TransactionReceipt> addParticipant(List<Participant> participants) {
        final Function function = new Function(
                FUNC_ADDPARTICIPANT, 
                Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<Participant>(Participant.class, participants)), 
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteFunctionCall<BigInteger> isInParticipantMap(String participant) {
        final Function function = new Function(FUNC_ISINPARTICIPANTMAP, 
                Arrays.<Type>asList(new Address(160, participant)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint16>() {}));
        return executeRemoteCallSingleValueReturn(function, BigInteger.class);
    }

    @Deprecated
    public static __Test02_sol_Test02 load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return new __Test02_sol_Test02(contractAddress, web3j, credentials, gasPrice, gasLimit);
    }

    @Deprecated
    public static __Test02_sol_Test02 load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return new __Test02_sol_Test02(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
    }

    public static __Test02_sol_Test02 load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
        return new __Test02_sol_Test02(contractAddress, web3j, credentials, contractGasProvider);
    }

    public static __Test02_sol_Test02 load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
        return new __Test02_sol_Test02(contractAddress, web3j, transactionManager, contractGasProvider);
    }

    public static RemoteCall<__Test02_sol_Test02> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
        return deployRemoteCall(__Test02_sol_Test02.class, web3j, credentials, contractGasProvider, BINARY, "");
    }

    @Deprecated
    public static RemoteCall<__Test02_sol_Test02> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return deployRemoteCall(__Test02_sol_Test02.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
    }

    public static RemoteCall<__Test02_sol_Test02> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
        return deployRemoteCall(__Test02_sol_Test02.class, web3j, transactionManager, contractGasProvider, BINARY, "");
    }

    @Deprecated
    public static RemoteCall<__Test02_sol_Test02> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return deployRemoteCall(__Test02_sol_Test02.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
    }

    @Data
    @Builder
    public static class Participant extends StaticStruct {
        public String participant;

        public BigInteger id;

        public Participant(String participant, BigInteger id) {
            super(new Address(160, participant),
                    new Uint16(id));
            this.participant = participant;
            this.id = id;
        }

        public Participant(Address participant, Uint16 id) {
            super(participant, id);
            this.participant = participant.getValue();
            this.id = id.getValue();
        }
    }
}
